<?php
/**
 * Created by PhpStorm.
 * User: divya
 * Date: 2018/7/3
 * Time: 下午6:29
 */

namespace app\api\controller\v1;

use app\api\validate\IDMustBePositiveInt;
use app\api\model\Banner as BannerModel;
use app\lib\exception\BannerMissExcetion;

class Banner
{
    /*
     * 根据id位置请求轮播图
     * URL /banner/：id
     * http: get
     * @id banner的id号
     *
     */
    public static function getBanner($id)
    {
        (new IDMustBePositiveInt())->goCheck();
        $banner = BannerModel::getBannerById($id);
        if (!$banner){
            throw new BannerMissExcetion();
        }
        return $banner;
    }

    public static function hello()
    {
        return 'hello lubin';
    }


}